package com.itheima.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

/*
工具类创建 最大线程数的 线程池
 */
public class Demo02 {

    public static void main(String[] args) {
        ExecutorService pool = Executors.newFixedThreadPool(10);
      ThreadPoolExecutor pooll= (ThreadPoolExecutor) pool;
        for (int j=0;j<100;j++) {
            int finalJ = j;
            pool.submit(()->{
                for (int i = 0; i < 10; i++) {
                    System.out.println(Thread.currentThread().getName()+"执行第"+ finalJ +"个任务"+i);
                }
            });
        }


    }
}
